package tree.person;

import java.awt.image.BufferedImage;


/** class describe one person in tree */
public class Person {

	/** id person */
	private long id;
	/** id mother */
	private long mumId;
	/** id father */
	private long dadId;

	/** persons name */
	private String name;
	/** persons surname */
	private String surname;
	/** persons sex */
	private String sex;
	/** persons view */
	private String foto;
	
	private BufferedImage image;

	/** default constructor **/
	public Person(){
		
	}
	
	/** constructor for lazy loading **/
	public Person(long id){
		this.id = id;
	}


	/** constructor fills a class field */
	public Person(long id, long mumId, long dadId, String name, String surname, String sex, String foto) {
		this.id = id;
		this.mumId = mumId;
		this.dadId = dadId;
		this.name = name;
		this.surname = surname;
		this.sex = sex;
		this.foto = foto;

		//console print:
		this.printClass();
	}


	public long getId() {
		return id;
	}


	public void setId(long id) {
		this.id = id;
	}


	public long getMumId() {
		return mumId;
	}


	public void setMumId(long mumId) {
		this.mumId = mumId;
	}


	public long getDadId() {
		return dadId;
	}


	public void setDadId(long dadId) {
		this.dadId = dadId;
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public String getSurname() {
		return surname;
	}


	public void setSurname(String surname) {
		this.surname = surname;
	}


	public String getSex() {
		return sex;
	}


	public void setSex(String sex) {
		this.sex = sex;
	}


	public String getFoto() {
		return foto;
	}


	public void setFoto(String foto) {
		this.foto = foto;
	}


	/** print new Person */
	public void printClass() {
		System.out.println(this.toString());
	}


	/** string format class */
	public String toString() {
		return String.format("%10d %s %s (%s) - %d:%d", id, surname, name, sex, mumId, dadId);
	}

	public void setImage(BufferedImage image) {
		this.image = image;
	}

	public BufferedImage getImage() {
		return image;
	}
}
